<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			function suan(type){
				var num1 = document.getElementById("num1").value;
				var num2 = document.getElementById("num2").value;
				var result;
				switch (type){
					case "+":
					result = parseInt(num1) + parseInt(num2);
						break;
						case "-":
					result = parseInt(num1) - parseInt(num2);
						break;
						case "*":
					result = parseInt(num1) * parseInt(num2);
						break;
						case "/":
					result = parseInt(num1) / parseInt(num2);
						break;
					default:
						break;
				}
				document.getElementById("result").value = result;
			}
		
		</script>
	</head>
	<body>
		<table>
			<tr>
			<td>
				<img src="../img/UODJC[}VYOB`V{5V~JKNZAG.png">
			</td>
			<th>购物简易计算器</th>
			</tr>
			<tr>
				<th>第一个数</th>
				<td>
					<input type="text" id="num1">
				</td>
			</tr>
			<tr>
				<th>第二个数</th>
				<td>
					<input type="text" id="num2">
				</td>
			</tr>
			<tr>
			<td>
			<input type="button" value="+" onclick="suan(this.value)">
			</td>
			<td>
				<input type="button" value="-" onclick="suan(this.value)">
				<input type="button" value="*" onclick="suan(this.value)">
				<input type="button" value="/" onclick="suan(this.value)">
			</td>
			</tr>
			<tr>
				<th>计算结果</th>
				<td>
					<input type="text" id="result">
				</td>
			</tr>
		</table>
		
	</body>
</html>
